package com.model;
// default package

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;


/**
 * User entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="db_user"
    ,catalog="acmctgu"
)

public class User  implements java.io.Serializable {


    // Fields    

     private Integer id;
     private String username;
     private String userpassword;
     private String role;
     private String qq;
     private String email;
     private String tel;
     private String stunum;
     private String major;
     private String college;
     private String realname;
     private Set<Programming> programmings = new HashSet<Programming>(0);
//     private Set<Paper> papers = new HashSet<Paper>(0);
     private Set<Proanswer> proanswers = new HashSet<Proanswer>(0);
     private Set<Apply> applies = new HashSet<Apply>(0);


    // Constructors

    /** default constructor */
    public User() {
    }

	/** minimal constructor */
    public User(String username, String userpassword, String role, String tel) {
        this.username = username;
        this.userpassword = userpassword;
        this.role = role;
        this.tel = tel;
    }
    
    /** full constructor */
    public User(String username, String userpassword, String role, String qq, String email, String tel, String stunum, String major, String college, String realname,Set<Programming> programmings, Set<Paper> papers, Set<Proanswer> proanswers, Set<Apply> applies) {
        this.username = username;
        this.userpassword = userpassword;
        this.role = role;
        this.qq = qq;
        this.email = email;
        this.tel = tel;
        this.stunum = stunum;
        this.major = major;
        this.college = college;
        this.realname = realname;
       // this.programmings = programmings;
       // this.papers = papers;
       // this.proanswers = proanswers;
       // this.applies = applies;
    }

   
    // Property accessors
    @Id @GeneratedValue
    
    @Column(name="id", unique=true, nullable=false)

    public Integer getId() {
        return this.id;
    }
    
    public void setId(Integer id) {
        this.id = id;
    }
    
    @Column(name="username", nullable=false,length=50)

    public String getUsername() {
        return this.username;
    }
    
    public void setUsername(String username) {
        this.username = username;
    }
    
    @Column(name="userpassword", nullable=false, length=30)

    public String getUserpassword() {
        return this.userpassword;
    }
    
    public void setUserpassword(String userpassword) {
        this.userpassword = userpassword;
    }
    
    @Column(name="role", nullable=false, length=4)

    public String getRole() {
        return this.role;
    }
    
    public void setRole(String role) {
        this.role = role;
    }
    
    @Column(name="qq", length=30)

    public String getQq() {
        return this.qq;
    }
    
    public void setQq(String qq) {
        this.qq = qq;
    }
    
    @Column(name="email", length=50)

    public String getEmail() {
        return this.email;
    }
    
    public void setEmail(String email) {
        this.email = email;
    }
    
    @Column(name="tel", nullable=false, length=50)

    public String getTel() {
        return this.tel;
    }
    
    public void setTel(String tel) {
        this.tel = tel;
    }
    
    @Column(name="stunum", length=30)

    public String getStunum() {
        return this.stunum;
    }
    
    public void setStunum(String stunum) {
        this.stunum = stunum;
    }
    
    @Column(name="major", length=30)

    public String getMajor() {
        return this.major;
    }
    
    public void setMajor(String major) {
        this.major = major;
    }
    
    @Column(name="college", length=30)

    public String getCollege() {
        return this.college;
    }
    
    public void setCollege(String college) {
        this.college = college;
    }

    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="user")

    public Set<Programming> getProgrammings() {
        return this.programmings;
    }
    
    public void setProgrammings(Set<Programming> programmings) {
        this.programmings = programmings;
    }
    
//    @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="user")
//
//    public Set<Paper> getPapers() {
//        return this.papers;
//    }
//    
//    public void setPapers(Set<Paper> papers) {
//        this.papers = papers;
//    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="user")

    public Set<Proanswer> getProanswers() {
        return this.proanswers;
    }
    
    public void setProanswers(Set<Proanswer> proanswers) {
        this.proanswers = proanswers;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="user")

    public Set<Apply> getApplies() {
        return this.applies;
    }
    
    public void setApplies(Set<Apply> applies) {
        this.applies = applies;
    }

    @Column(name="realname", length=30)
    
	public String getRealname() {
		return realname;
	}

	public void setRealname(String realname) {
		this.realname = realname;
	}
   








}